package com.dubito.pattern.开闭原则;

import java.util.ArrayList;
import java.util.List;

/**
 * @author liliang
 * @date 2020/8/26.
 */
public class BookStore {

    private List<IBook> bookList = new ArrayList<IBook>();

    public BookStore() {
        bookList.add(new OffNovelBook("西游记",70.2, "吴承恩"));
        bookList.add(new OffNovelBook("红楼梦",80.2, "曹雪芹"));
        bookList.add(new OffNovelBook("三国演义",30.2, "罗贯中"));
        bookList.add(new OffNovelBook("水浒传",100, "施耐庵"));
    }

    public void showBook() {
        System.out.println("-------------书店售书列表---------------");
        System.out.println("书名\t\t\t 价格\t\t 作者");
        for (IBook book : bookList) {
            System.out.println(book.getName()+"\t\t"+book.getPrice()+"元\t\t"+book.getAuthor());
        }
    }

    public static void main(String[] args) {

        BookStore bookStore = new BookStore();
        bookStore.showBook();
    }
}
